//
//  UIImageManager.m
//  KEREN
//
//  Created by MW on 2023/4/11.
//

#import "UIImageManager.h"

@implementation UIImageManager
+ (instancetype)shareInstance {
    static UIImageManager *manager;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[self alloc]init];
    });
    return manager;
}
- (UIImage *)setPointImageWithTitle:(NSString *)title{
    UIView *imageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    imageView.layer.cornerRadius = 15;
    imageView.clipsToBounds = YES;
    UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(2, 2, 26, 26)];
    if([title isEqualToString:@"起"]){
        lbl.textColor = Whire_Color;
        lbl.backgroundColor = Color_7ACC00;
        imageView.backgroundColor = Whire_Color;
    }else{
        lbl.textColor = Color_7ACC00;
        lbl.backgroundColor = Whire_Color;
        imageView.backgroundColor = Color_7ACC00;
    }
    lbl.font = BFont(14);
    lbl.text = title;
    lbl.layer.cornerRadius = 13;
    lbl.clipsToBounds = YES;
    lbl.textAlignment = NSTextAlignmentCenter;
    [imageView addSubview:lbl];
    
    UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 0.0);
    [imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
@end
